//
//  ICChatAdaptBaseCell.m
//  AFNetworking
//
//  Created by zhangrongwu on 2018/1/23.
//

#import "ICChatAdaptBaseCell.h"

@implementation ICChatAdaptBaseCell

- (instancetype)initWithStyle:(UITableViewCellStyle)cell reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:cell reuseIdentifier:reuseIdentifier];
    if (self) {
        [self.contentView addSubview:self.bottomLine];
    
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        UILongPressGestureRecognizer *longRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressRecognizer:)];
        longRecognizer.minimumPressDuration = 0.3;
        [self.contentView addGestureRecognizer:longRecognizer];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

-(void)setData:(id)data {
    
}

-(void)layoutSubviews {
    [super layoutSubviews];
    
    //    [self.bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
    //        make.right.and.left.mas_equalTo(self.contentView);
    //        make.height.mas_equalTo(1);
    //        make.top.equalTo(你的控件.mas_bottom);
    //        make.bottom.mas_equalTo(self.contentView.mas_bottom);
    //    }];
}

-(UIView *)bottomLine {
    if (!_bottomLine) {
        _bottomLine = [[UIView alloc] init];
        _bottomLine.alpha = 0;
    }
    return _bottomLine;
}

#pragma mark - longPress delegate

- (void)longPressRecognizer:(UILongPressGestureRecognizer *)recognizer
{
    if ([self.longPressDelegate respondsToSelector:@selector(longPress:)]) {
        [self.longPressDelegate longPress:recognizer];
    }
}

@end
